/* 响应式设计样式 */

/* 断点定义 */
/* xs: 0px - 575px (超小屏幕) */
/* sm: 576px - 767px (小屏幕) */
/* md: 768px - 991px (中等屏幕) */
/* lg: 992px - 1199px (大屏幕) */
/* xl: 1200px+ (超大屏幕) */

/* 超小屏幕 (手机) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: var(--font-size-base);
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .demo-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        margin: var(--spacing-sm);
        max-width: calc(100% - 2rem);
    }
    
    .notification-container {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .page-btn {
        min-width: 35px;
        height: 35px;
        font-size: var(--font-size-sm);
    }
    
    .tab-nav {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 0;
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* 小屏幕 (大手机) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .demo-content {
        justify-content: center;
    }
    
    .btn {
        min-width: 120px;
    }
}

/* 中等屏幕 (平板) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .demo-content {
        justify-content: flex-start;
    }
    
    .nav-menu {
        gap: var(--spacing-md);
    }
    
    .component-demo {
        grid-template-columns: 1fr;
    }
}

/* 大屏幕 (桌面) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .component-demo {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 超大屏幕 (大桌面) */
@media (min-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .component-demo {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 1140px;
    }
}

/* 移动设备导航 */
@media (max-width: 767.98px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: var(--transition);
        box-shadow: var(--shadow);
        padding: var(--spacing-lg) 0;
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: var(--spacing-sm) 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .page-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tab-btn {
        min-height: 44px;
    }
    
    .accordion-btn {
        min-height: 44px;
    }
    
    .checkbox-mark,
    .radio-mark {
        width: 24px;
        height: 24px;
    }
    
    .form-input,
    .form-select {
        min-height: 44px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn,
    .form-input,
    .form-select {
        border-width: 0.5px;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .back-to-top,
    .notification-container,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .component-section {
        page-break-inside: avoid;
        border-bottom: none;
    }
    
    .demo-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn {
        border: 1px solid #000;
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    .hero {
        background: white !important;
        color: black !important;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8f9fa;
        --light-color: #343a40;
    }
    
    body {
        background-color: #121212;
        color: var(--dark-color);
    }
    
    .navbar {
        background: #1f1f1f;
        border-bottom: 1px solid #333;
    }
    
    .demo-item {
        background: #1f1f1f;
        border-color: #333;
    }
    
    .form-input,
    .form-select {
        background-color: #2d2d2d;
        border-color: #444;
        color: var(--dark-color);
    }
    
    .form-input:focus,
    .form-select:focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
    }
    
    .card {
        background-color: #1f1f1f;
        border-color: #333;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        background-color: #1f1f1f;
        color: var(--dark-color);
    }
    
    .accordion-btn {
        background-color: #1f1f1f;
        color: var(--dark-color);
    }
    
    .accordion-btn:hover {
        background-color: #2d2d2d;
    }
    
    .accordion-body {
        background-color: #2d2d2d;
    }
    
    .breadcrumb {
        background-color: #2d2d2d;
    }
    
    .notification {
        background-color: #1f1f1f;
        border-color: #333;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .component-section {
        padding: var(--spacing-lg) 0;
    }
    
    .modal-container {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 超宽屏幕优化 */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .component-demo {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 可访问性增强 */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .form-input,
    .form-select {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
}

/* 工具类 - 显示/隐藏 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* 响应式显示工具类 */
@media (max-width: 575.98px) {
    .d-xs-none { display: none !important; }
    .d-xs-block { display: block !important; }
    .d-xs-flex { display: flex !important; }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
}

